//
//  MainAreaCitysViewController.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/20.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MainAreaCitysViewController.h"
#import "MainAreaCitysViewModel.h"
#import "MyStoreInformationViewController.h"

@interface MainAreaCitysViewController ()
@property (nonatomic, strong) MainAreaCitysViewModel *viewModel;

@end

@implementation MainAreaCitysViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.viewModel = [[MainAreaCitysViewModel alloc] initWithViewToViewModel:self.groupedTableView theSuperView:self.view];
    self.viewModel.dic = [NSMutableDictionary dictionaryWithDictionary:self.dic];
    [self addNavigationItemWithTitles:@[@"保存"] isLeft:NO target:self action:@selector(keepAll) tags:@[@2223] theButTitColor:[UIColor colorWithHexString:@"#A89A60"] titFont:SYSTEMFONT(14)];
    [self addNavigationItemWithImageNames:@[@"jiantou"] isLeft:YES target:self action:@selector(leftAction) tags:@[@222]];
    
}

- (void)keepAll
{    
    for (UIViewController *vc in self.rt_navigationController.rt_viewControllers) {
        if ([vc isKindOfClass:[MyStoreInformationViewController class]]) {
            MyStoreInformationViewController *mainVC = (MyStoreInformationViewController *)vc;
            [self.navigationController popToViewController:mainVC animated:YES];
            KPostNotification(@"kMainArealList", self.viewModel.dic);
        }
    }
}
     
- (void)leftAction
{
    if (self.BlockSelectDic) {
        self.BlockSelectDic(self.viewModel.dic);
    }
    [self.navigationController popViewControllerAnimated:YES];
}

@end
